package org.jeecg.modules.demo.cashier;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.demo.mall.entity.YxRechargePackage;
import org.jeecg.modules.demo.mall.yxrechargepackage.service.IYxRechargePackageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;

/**
* @Description: 储值套餐表
* @Author: jeecg-boot
* @Date:   2023-10-31
* @Version: V1.0
*/
@Api(tags="储值套餐表")
@RestController
@RequestMapping("/mall/cashierrechargepackage/cashierRechargePackage")
@Slf4j
public class CashierRechargePackageController extends JeecgController<YxRechargePackage, IYxRechargePackageService> {
   @Autowired
   private IYxRechargePackageService yxRechargePackageService;

   /**
    * 根据输入金额查询小于等于输入金额的优惠券
    *
    * @param yxRechargePackage
    * @return
    */
   @GetMapping(value = "/queryList")
   public Result<?> queryList(YxRechargePackage yxRechargePackage) {
       QueryWrapper<YxRechargePackage> queryWrapper = new QueryWrapper<>();
       queryWrapper.le("price",yxRechargePackage.getPrice());
       queryWrapper.orderByDesc("price");
       List<YxRechargePackage> pageList = yxRechargePackageService.list(queryWrapper);
       return Result.OK(pageList);
   }
}
